Skip to content

build: keep tsdown.config.ts real TypeScript, fix the actual root cause instead - #8

Merged
Mearman merged 4 commits into
mainfrom
fix/keep-tsdown-config-ts
Sep 10, 2026
Merged

build: keep tsdown.config.ts real TypeScript, fix the actual root cause instead#8
Mearman merged 4 commits into
mainfrom
fix/keep-tsdown-config-ts

Conversation

@Mearman

@Mearman Mearman commented Sep 10, 2026

Copy link
Copy Markdown
Member

#7 worked around a real bug (a git-dependency install's own "prepare" script can't load tsdown.config.ts, because that install always resolves under node_modules and Node's native TS-stripping refuses to process a .ts file there) by demoting the config to plain JS. That fixes the symptom but not the cause: the actual problem is that a git-dependency install needs to build at all.

This fixes it at the source instead: dist/ is now committed, so a git-dependency install has nothing to build -- the prepare script (and the node_modules-TS-stripping restriction it was tripping) goes away entirely, and tsdown.config.ts stays real TypeScript for everyone working on the repo directly.

Verified against the actual failure mode: git archive'd this branch's HEAD into a nested node_modules/cddl.js/ path (exactly what a real git-dependency install produces), ran pnpm install there, confirmed no build runs (no "prepare" script exists), and imported all three entry points (dist/emitter.mjs, dist/parse.mjs, dist/runtime.mjs) directly to confirm they actually work.

CI now also rebuilds from source on every push and fails if dist/ doesn't match what's committed, so it can't silently drift.

pnpm/npm only run a git dependency's own build (the "prepare" script) from inside a node_modules/ checkout -- exactly the one path Node's native TypeScript-stripping refuses to run against a .ts file. Committing dist/ removes the need for that build step entirely: a git-dependency install gets already-built output straight from the checkout, so the restriction never comes up, and tsdown.config.ts can stay a real TypeScript file for everyone working on this repo directly instead of being downgraded to plain JS to dodge it.
With dist/ now committed, the "prepare" script that ran a full build on every git-dependency install has nothing left to do -- remove it. tsdown.config.js reverts to tsdown.config.ts (nothing in the install path loads it anymore, so Node's node_modules TS-stripping restriction never applies to it), and every reference to the old plain-JS filename (turbo.json's _build inputs, eslint's ignore list, tsconfig.node.json's include) reverts to match. vendor/cddl/dist/ moves to .gitignore: dist/ already bundles its compiled output inline, so it's a build intermediate again, not something that needs tracking.
Rebuilds from source on every push and fails the check if dist/ doesn't match what's committed, so a change to src/ that isn't paired with a regenerated dist/ can't merge silently out of date.
@Mearman
Mearman marked this pull request as ready for review September 10, 2026 09:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-10T10:01:07.349121Z a83c71e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit fbaed5f into main Sep 10, 2026
1 check passed
@Mearman
Mearman deleted the fix/keep-tsdown-config-ts branch September 10, 2026 10:01
Mearman added a commit to ExaDev/wire-mesh that referenced this pull request Sep 10, 2026
The previous fix (a prepare script that builds cddl.js during install)
still failed in CI: eslint's type-aware linting of generate.ts
resolved parse/emitModule to an error type, not real type info,
something never reproduced locally across four different attempts
(hoisted and isolated pnpm linkers, a from-scratch store, a genuine
Linux container matching CI's exact Node/pnpm versions).

Fixed upstream properly instead of chasing the install-time build
further: ExaDev/cddl.js#8 commits pre-built, attw-verified dist/
output and removes the prepare script entirely, so a git-dependency
install ships already-correct code and type declarations with no
build step, and therefore no install-time environment sensitivity, at
all.
Mearman added a commit to ExaDev/wire-mesh that referenced this pull request Sep 10, 2026
The previous fix (a prepare script that builds cddl.js during install)
still failed in CI: eslint's type-aware linting of generate.ts
resolved parse/emitModule to an error type, not real type info,
something never reproduced locally across four different attempts
(hoisted and isolated pnpm linkers, a from-scratch store, a genuine
Linux container matching CI's exact Node/pnpm versions).

Fixed upstream properly instead of chasing the install-time build
further: ExaDev/cddl.js#8 commits pre-built, attw-verified dist/
output and removes the prepare script entirely, so a git-dependency
install ships already-correct code and type declarations with no
build step, and therefore no install-time environment sensitivity, at
all.
Mearman added a commit to ExaDev/wire-mesh that referenced this pull request Sep 10, 2026
The previous fix (a prepare script that builds cddl.js during install)
still failed in CI: eslint's type-aware linting of generate.ts
resolved parse/emitModule to an error type, not real type info,
something never reproduced locally across four different attempts
(hoisted and isolated pnpm linkers, a from-scratch store, a genuine
Linux container matching CI's exact Node/pnpm versions).

Fixed upstream properly instead of chasing the install-time build
further: ExaDev/cddl.js#8 commits pre-built, attw-verified dist/
output and removes the prepare script entirely, so a git-dependency
install ships already-correct code and type declarations with no
build step, and therefore no install-time environment sensitivity, at
all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant